/*
 *说明：用户运维时间审计脚本
 *
 *@author liuxun 2012-03-06
*/

var opeForm;
var grid;

$(function(){
	opeForm = $('#opeForm');

	grid=$('#listTable').datagrid({
		frozenColumns:[[
            //{title:'选择',field:'ck',checkbox:true}
		]],
		columns:[[

            {title:'用户名',field:'USR_NAME',align:'center',width:80},
            
            {title:'小时',field:'HOUR',align:'center',width:80},
            
            {title:'分钟',field:'MINUTE',align:'center',width:80},
            
            {title:'秒',field:'SECOND',align:'center',width:80}
            
        ]]
	});

	queryOperation();

	$('#queryBtn').click(queryOperation);
	$('#clearBtn').click(clearOperation);
	$('#reloadBtn').click(refreshWin);
	$('#genReportBtn').click(genReporOperation);
});

//翻页时自动调用此函数
function onLoadPrev(msg){
	var queryParams=grid.datagrid('options').queryParams;
	queryParams['firstQuery']=false;
}

//查询操作
function queryOperation(){
	var params = opeForm.serializeObject();
	grid.datagrid("options").pageNumber = 1;
	grid.datagrid({
		url: 'AUDIT_REPORT!queryMonthlyUsrLogAuditList.do',
		queryParams: jQuery.extend({}, params, {'firstQuery': true})
	});
}

//清空操作（重置）
function clearOperation() {
	opeForm.resetForm();
}

//选择资源组
function select_c_rsc_grp() {
	var action = "C_RSC_GRP!showSelect.do";
	var row = showModalWin(action,'A2');
	
	if (row) {
		$('#rsc_grp_id').val(row.rsc_grp_id);
		$('#rsc_grp_name').val(row.rsc_grp_name);
	}
}

//生成运维月度人员日志汇总统计表
function genReporOperation() {
	opeForm.attr('action', 'AUDIT_REPORT!genMonthlyUsrLogAuditReport.do');
	opeForm.attr('target', 'hideWindow');
	opeForm.submit();
}

// 操作成功后刷新列表
function afterOK(){
	queryOperation();
}